package com.lingshi.shopping_search_service.listener;

import com.lingshi.common.constant.Const;
import com.lingshi.common.entity.GoodsDesc;
import com.lingshi.common.entity.GoodsES;
import com.lingshi.common.service.IGoodsSearchService;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@RocketMQMessageListener(consumerGroup = Const.SYNC_GOODS_GROUP,topic = Const.SYNC_GOODS_QUEUE)
public class SyncGoodsListener implements RocketMQListener<GoodsDesc> {

    @Autowired
    private IGoodsSearchService goodsSearchService;
    @Override
    public void onMessage(GoodsDesc goodsDesc) {

        goodsSearchService.syncGoodsToEs(goodsDesc);

    }
}
